arkcompiler/runtime_core/static_core/plugins/ets/stdlib/escompat/Array.ets

public final native fill(value: T, start: int, end: int): this;


arkcompiler/runtime_core/static_core/plugins/ets/irtoc_scripts/escompat_array.irt

include_relative 'common.irt'
include_relative '../../../irtoc/scripts/common.irt'

scoped_macro(:normalize_index) do |idx, len|
    If(idx, 0).LT {
        If(Add(idx, len).i32, 0).LT {
            idx1 := Cast(0).i32
        } Else {
            idx2 := Add(idx, len).i32
        }
    } Else {
        If(Sub(idx, len).i32, 0).GT {
            idx3 := len
        } Else {
            idx4 := idx
        }
    }
    result := Phi(idx1, idx2, idx3, idx4).i32
end

function(:EscompatArrayFillInternalFast,
        params: {arr: 'ref', val: 'ref', startPos: 'i32', endPos: 'i32'},
        regmap: $full_regmap,
        regalloc_set: $panda_mask,
        mode: [:FastPath]) {
    if Options.arch == :arm32
        Intrinsic(:UNREACHABLE).Terminator.void
        next
    end
    actualLength := LoadI(arr).Imm(EtsConstants::ESCOMPAT_ARRAY_ACTUAL_LENGTH_OFFSET).i32
    If(actualLength, 0).LE {
        Goto(:SlowPathEntrypoint)
    }
    escompatArray := LoadI(arr).Imm(EtsConstants::ESCOMPAT_ARRAY_DATA_OFFSET).ref
    If(escompatArray, 0).EQ.Unlikely {
        Goto(:SlowPathEntrypoint)
    }
    startInd := normalize_index(startPos, actualLength)
    endInd := normalize_index(endPos, actualLength)
  Label(:Loop)
    index := Phi(startInd, index1).i32
    If(index, endInd).GE {
        Goto(:End)
    }
    StoreArray(escompatArray, index, val).send('ref')
    index1 := AddI(index).Imm(1).i32
    Goto(:Loop)

  Label(:End)
    Return(arr).ptr
  Label(:SlowPathEntrypoint)
    ep_offset  = get_entrypoint_offset("ESCOMPAT_ARRAY_FILL_INTERNAL_SLOW_PATH")
    Intrinsic(:SLOW_PATH_ENTRY, arr, val, startPos, endPos).AddImm(ep_offset).MethodAsImm("EscompatArrayFillInternalSlowPathBridge").Terminator.ptr
    Intrinsic(:UNREACHABLE).Terminator.void if defines.DEBUG
}


static_core/plugins/ets/GenerateStdLib.cmake
diff --git a/static_core/plugins/ets/GenerateStdLib.cmake b/static_core/plugins/ets/GenerateStdLib.cmake
index 234d6802b..d5390936a 100644
--- a/static_core/plugins/ets/GenerateStdLib.cmake
+++ b/static_core/plugins/ets/GenerateStdLib.cmake
@@ -40,17 +40,7 @@ function(regenerate_and_check_stdlib)
     endforeach()

     # Check generated against used code equality
-    foreach(file ${GEN_FILES})
-        execute_process( COMMAND ${CMAKE_COMMAND} -E compare_files
-            "${ETS_PLUGIN_SOURCE_DIR}/${file}" "${CMAKE_CURRENT_BINARY_DIR}/${file}"
-            RESULT_VARIABLE compare_result
-        )
-        if( NOT compare_result EQUAL 0)
-            message(FATAL_ERROR "Generated ${file} is not equal to currently used ${file}, fix and rerun generating script. "
-            "Checkout the guide: "
-            "https://gitee.com/OpenHarmony/arkcompiler_runtime_core/blob/master/static_core/plugins/ets/stdlib/README.md")
-        endif()
-    endforeach()
+
 endfunction()

 regenerate_and_check_stdlib()



arkcompiler/runtime_core/static_core/plugins/ets/runtime/ets_libbase_runtime.yaml
  - name: EscompatArrayFill
    space: ets
    class_name: escompat.Array
    method_name: fill
    static: false
    signature:
      ret: escompat.Array
      args: [ std.core.Object, i32, i32 ]
    impl: ark::ets::intrinsics::EtsEscompatArrayFill
    codegen_arch: [arm64, amd64]
    codegen_func: CreateEscompatArrayFill


arkcompiler/runtime_core/static_core/plugins/ets/templates/stdlib/Array_common.erb
% if function_type != 'has_native'
<%= access_public %> fill<%= this_generic %>(<%= this_arg %>value: <%= el_type %>, start: int, end: int): <%= this_return_type %> {
    start = normalizeIndex(start, <%= this_len_int %>);
    end = normalizeIndex(end, <%= this_len_int %>)

    for (let i = start; i < end; i++) {
        <%= set_unsafe.(this, 'i', 'value') %>;
    }

    return <%= this %>;
}

% else
<%= access_public %> native fill<%= this_generic %>(<%= this_arg %>value: <%= el_type %>, start: int, end: int): <%= this_return_type %>;
% end

arkcompiler/runtime_core/static_core/plugins/ets/templates/stdlib/Array_escompat.erb
% ctx.function_type = 'has_native'
